<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.js"></script>
</head>

<body>
    <div id="app">
        <div>
            {{sex | formatterSex(name)}}
        </div>
    </div>
</body>
<script>
    new Vue({
        el: '#app',
        // data:{},
        data() {
            return {
                sex: 1,
                name: '莉丝'
            }
        },
        filters: {
            formatterSex(val1, val2) {
                if (val1 == 1) {
                    return val2 + '的性别是男'
                } else if (val1 == 0) {
                    return val2 + '的性别是女'
                } else {
                    return val2 + '的性别是未知'
                }
            }
        }
    })
</script>

</html>